package com.laxcen.toydemo;

/**
 * Create by Sxl on 2021/6/29.
 */
public class Utils {

    private static long lastClickTime = 0;
    private final static int SPACE_TIME =1000;

    public synchronized static boolean isDoubleClick() {
        long currentTime = System.currentTimeMillis();
        boolean isClickDouble;
        if (currentTime - lastClickTime >
                SPACE_TIME) {
            isClickDouble = false;
        } else {
            isClickDouble = true;
        }
        lastClickTime = currentTime;
        return isClickDouble;
    }

}
